package com.ftg.learn.controller;

import com.ftg.learn.entity.SysRoleEntity;
import com.ftg.learn.service.SysRoleService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Optional;

@RestController
@RequestMapping("/sysRole")
public class SysRoleController {

    @Resource
    private SysRoleService sysRoleService;

    @GetMapping("/RoleById")
    public Optional<SysRoleEntity> getRoleById(int id) {
        return sysRoleService.getRoleById(id);
    }

    @GetMapping("/RoleByName")
    public List<SysRoleEntity> getRoleByName(String roleName) {
        return sysRoleService.getRoleByName(roleName);
    }

}
